window.onload = function() {

	/* 上午迟到 */
	var mornjudges = "07:40";
	var mornjudge = "19:40";
	var morntime = $(".morntime").val();
	var team = $(".team").val();
	morntime = morntime.slice(11, morntime.length - 3);
	if (team == 1) {
		if (morntime > mornjudges) {
			$(".morntime").css("color", 'red');
		}
	} else {
		if (morntime > mornjudge) {
			$(".morntime").css("color", 'red');
		}
	}

	/* 上午早退 */
	var forenoon = "11:40";
	var forenoons = "7:40";
	var morntime = $(".morntimes").val();
	var team = $(".team").val();
	morntime = morntime.slice(11, morntime.length - 3);
	if (team == 1) {
		if (morntime < forenoon) {
			$(".morntimes").css("color", 'red');
		}
	} else {
		if (morntime < forenoons) {
			$(".morntimes").css("color", 'red');
		}
	}

	/* 下午迟到 */
	var mornjudgec = "13:30";
	var mornjudgecs = "19:40";
	var aftertime = $(".aftertime").val();
	team = $(".team").val();
	aftertime = aftertime.slice(11, aftertime.length - 3);
	if (team == 1) {
		if (aftertime > mornjudgec) {
			$(".aftertime").css("color", 'red');
		}

	} else {
		if (aftertime > mornjudgecs) {
			$(".aftertime").css("color", 'red');
		}
	}

	/* 下午早退 */
	var aftera = "19:40";
	var afterb = "07:40";
	var aftertimes = $(".aftertimes").val();
	team = $(".team").val();
	aftertimes = aftertimes.slice(11, aftertimes.length - 3);
	if (team == 1) {
		if (aftertimes < aftera) {
			$(".aftertimes").css("color", 'red');
		}

	} else {
		if (aftertimes < afterb) {
			$(".aftertimes").css("color", 'red');
		}
	}

	var morningtime = $(".morningtime").val();
	var time = morningtime.slice(11, morningtime.length);
	$(".morningtime").val(time);

	var teams = $(".teams").val();
	if (teams == 1) {
		var morningtimes = $(".morningtimes").val();
		var time = morningtimes.slice(11, morningtimes.length);
		$(".morningtimes").val(time);
	}

	if (teams == 1) {
		var afternoontime = $(".afternoontime").val();
		var time = afternoontime.slice(11, afternoontime.length);
		$(".afternoontime").val(time);
	}

	var afternoontimes = $(".afternoontimes").val();
	var time = afternoontimes.slice(11, afternoontimes.length);
	$(".afternoontimes").val(time);
}